<?php

class PageMessages extends Page
{
	protected $userEmail = "";
	
	public function getUserEmail()
	{
		return $this->userEmail;
	}
	
	public function getHTML()
	{
		$html = $this->getHeaderHTML();

		$submitScript = new SubmitFormScript();
		$html .= $submitScript->getHTML();

		$script = new EditDeleteFormScript();
		$html .= $script->getHTML();

		$html .= $this->getBodyTopHTML();
		$html .= $this->getHiddenVariables();

		$View = new Hidden();
		$View->setName("CallingPage");
		$View->setValue('Messages');
		$html .= $View->gethtml();
		
		$sql = "SELECT *  FROM SnapUsers";
		$this->Database->ExecuteSQL($sql);
		$recipients = array();
		while($row=$this->Database->getRow())
		{
			if($this->getUser()==$row['LongName'])$this->userEmail = $row['Email'];
			$recipient['Name'] = $row['LongName'];
			$recipient['Email'] = $row['Email'];
			array_push($recipients,$recipient);
		}
		
		$panel = new PanelGroupMail;
		$panel->setParentPage($this);
		$panel->setRecipients($recipients);
		
		$html .= $panel->getHTML();


		$html .= $this->getBodyBottomHTML();
		return $html;
	}
}
?>